fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. double a,b,c,d,x1,x2;
  4. int main()
  5. {
  6. cin>>a>>b>>c;
  7. if(a==0){
  8. if(b==0){
  9. if(c==0) cout<<"vo so nghiem";
  10. else cout<<"vo nghiem";
  11. }
  12. else cout<<-c/b;
  13. }
  14. else{
  15. d=b*b-4*a*c;
  16. if(d<0) cout<<"vo nghiem";
  17. else if(d==0) cout<<-b/(2*a);
  18. else{
  19. x1=(-b+sqrt(d))/(2*a);
  20. x2=(-b-sqrt(d))/(2*a);
  21. cout<<x1<<" "<<x2;
  22. }
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0s 544KB
stdin
1 2 1
stdout
-1